package com.weactivity.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private  Boolean success;
    private String erroMsg;
    private Object data;//真实传递的数据
    private Long total;

    //成功标志
    public static Result ok(){
        return new Result(true,null,null,null);
    };
    //结果
    public static Result ok(Object data){
        return new Result(true,null,data,null);
    }
    //结果数据和数量
    public static Result ok(List<?> data, Long total){
        return new Result(true , null , data,total);
    }
    //错误信息
    public static Result fail(String erroMsg){
        return new Result(false,erroMsg,null,null);
    }

}
